//
//  ZZCCommonProblemController.m
//  ZZC-Finance
//
//  Created by mac on 2017/5/23.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "ZZCCommonProblemController.h"

@interface ZZCCommonProblemController ()<UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UIWebView *questionWebV;
@property (strong, nonatomic) NSURL *uurl;
@property (copy,   nonatomic) NSString *imgUrl;

@end

@implementation ZZCCommonProblemController
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    float chacha = [[NSUserDefaults standardUserDefaults] floatForKey:@"appchacha"];
    chacha += 0.04;
    [[NSUserDefaults standardUserDefaults] setFloat:chacha forKey:@"appchacha"];

    self.questionWebV.delegate = self;
    self.title = @"常见问题";
    self.view.backgroundColor = ZZCBGColor;
    _questionWebV.scrollView.bounces = NO;

    NSURL *h5_URL = [NSURL URLWithString:ZZCURL_API_H5_QUESTION];
    NSURLRequest *request = [NSURLRequest requestWithURL:h5_URL];
    
    //让内容自动适应屏幕大小
    self.questionWebV.scalesPageToFit = YES;
    [self.questionWebV loadRequest:request];
    [self.view addSubview:self.questionWebV];
}

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    NSLog(@"%@",request);
    if ([request.URL.absoluteString containsString:@"http://www.stlh.com/action===back"]) {
        NSLog(@"已拦截");
        [self.navigationController popToRootViewControllerAnimated:YES];
        
        
        return NO;
        
    }
    return YES;
}

@end
